/*ui_mask编辑*/
(function ($) {
    $.fn.yqUiMaskEdit = function (opts, param) {
        if (typeof opts == 'string') {
            return $.fn.yqUiMaskEdit.methods[opts](this, param);
        }

        var $this = this;
        var opt;
        if ($this.data("yqtype") == "yqUiMaskEdit") {
            var $uniqueID = $this.attr("ID");
            var opts_ = $.extend({}, options($this));
            destroy($this);
            $this = $("#" + $uniqueID);
            opt = $.extend(opts_, opts);
        }
        else {
            opt = $.extend({}, $.fn.yqUiMaskEdit.defaults, opts);
            var $uniqueID = $this.attr("ID");
            if ($uniqueID === undefined || $uniqueID === null || $uniqueID == "") {
                $uniqueID = $.getUniqueID();
                $this.attr("ID", $uniqueID);
            }
        }

        if (opt.editModeW === undefined && $this.width() > 0) {
            opt.editModeW = $this.width();
        }
        else {
            if (opt.editModeW === undefined) {
                opt.editModeW = 400;
            }
            $this.width(opt.editModeW);
        }

        if (opt.editModeH === undefined && $this.height() > 0) {
            opt.editModeH = $this.height();
        }
        else {
            if (opt.editModeH === undefined) {
                opt.editModeH = 300;
            }
            $this.height(opt.editModeH);
        }

        opt._value = {};

        opt.uiTypes = [
            {
                "no": 1,
                "name": "Lable"
            }, {
                "no": 2,
                "name": "Textbox"
            }, {
                "no": 3,
                "name": "Checkbox"
            }, {
                "no": 4,
                "name": "Datetbox"
            }, {
                "no": 5,
                "name": "Richbox"
            }, {
                "no": 6,
                "name": "Combobox"
            }, {
                "no": 7,
                "name": "ForeignKey"
            }, {
                "no": 8,
                "name": "TreeSelect"
            }, {
                "no": 9,
                "name": "Numberbox"
            }, {
                "no": 10,
                "name": "Numberspinner"
            }, {
                "no": 11,
                "name": "TimeSpinner"
            }, {
                "no": 12,
                "name": "DateTimebox"
            }, {
                "no": 13,
                "name": "NCheckBox"
            }, {
                "no": 14,
                "name": "NForeignKey"
            }, {
                "no": 15,
                "name": "Table"
            }, {
                "no": 16,
                "name": "Tree"
            }, {
                "no": 17,
                "name": "Attr"
            }, {
                "no": 18,
                "name": "File"
            }, {
                "no": 19,
                "name": "Html"
            }];

        opt.fk_rows = [];

        opt.onload = false;

        //变量信息
        $this.data("uimask_opt", opt);
        $this.data("yqtype", "yqUiMaskEdit");

        init_pg($this);
    };

    $.fn.yqUiMaskEdit.defaults = {
        ui_type: 2,  //ui类型
        value: {},
        isEdit: true,
        treeEdit: false,   //attr、table、tree 参数是否可编辑
        defaultAdd: true,  //包含编辑框不包含的输入值
        afterBindingTitle: function () { },   //标题绑定后
        //自定义数据格式接口
        uiMaskLoadInit: function (ui_type, value, data) {
            return data;
        },
        endEdit: function (index, row) {

        },
    };

    $.fn.yqUiMaskEdit.methods = {
        options: function (jq) {
            return options(jq);
        },
        resize: function (jq, res) {
            var opt = options(jq);
            if (res.width === undefined) {
                res.width = opt.width;
            }
            if (res.height === undefined) {
                res.height = opt.height;
            }

            resize($(jq[0]), res.width, res.height);
        },
        setValue: function (jq, param) {   //{"ui_type":2,"value":""}
            setValue($(jq[0]), param.ui_type, param.value);
        },
        clear: function (jq) {
            clear(jq);
        },
        getUiType: function (jq) {
            return options(jq).ui_type;
        },
        getValue: function (jq) {
            return getValue($(jq[0]));
        },
        destroy: function (jq) {
            destroy(jq);
        },
        isEdit: function (jq, tf) {
            isEdit(jq, tf);
        },
        setField: function (jq, para) {
            if (para === undefined) {
                return;
            }
            if (para.name === undefined) {
                return;
            }
            if (para.value === undefined) {
                return;
            }

            setfield(jq, para.name, para.value)
        }
    };

    function options($object) {
        return $object.data("uimask_opt");
    }

    function form_load($object) {
        var opt = options($object);
        if (opt.onload) {
            return;
        }
        opt.onload = true;
        opt.afterBindingTitle.call($object);
    }

    function resize($object, width, height) {
        var opt = options($object);
        opt.editModeW = width;
        opt.editModeH = height;
        $object.propertygrid("resize", {
            width: width,
            height: height
        });
    }

    function destroy($object) {
        var $dg = $object.closest('div.datagrid');
        var $new_obj = $($object.prop("outerHTML"));
        $new_obj.show();
        var id = $object.attr("id");
        $new_obj.removeAttr("id");
        $dg.before($new_obj);
        $dg.remove();
        $new_obj.attr("id", id);
        $new_obj.removeClass("datagrid-f");

        $object.removeData("datagrid_opt");
        $object.removeData("yqtype");
    }

    function isEdit($object, tf) {
        var opt = options($object);
        opt.isEdit = tf;
        var value = getValue($object);
        setValue($object, opt.ui_type, value);
    }

    function init_pg($object) {
        var opt = options($object);

        $object.propertygrid({
            title: " ",
            tools: [{
                text: "json",
                iconCls: "yqwin-btn-icon-sub fa fa-eye",
                plain: true,
                handler: function () {
                    var prevent_e = $.getPreventDefault($(this));
                    prevent_e.clientX -= (opt.editModeW - 22);
                    prevent_e.clientY += 7;
                    prevent_e.id = $object.attr("id");
                    prevent_e.options = {};
                    var w = opt.editModeW;
                    var h = opt.editModeH - 32;
                    if (w > 600) {
                        w = 600;
                    }

                    var val = getValue($object);

                    var show_pops = {
                        prevent_e: prevent_e,
                        mdiinfo: $.yqGetWindParams(),
                        width: w,
                        height: h,
                        types: ["json"],
                        //types: ["html"],
                        type: "json",
                        value: JSON.stringify(val, null, 2),
                        isEdit: false,
                        goDocEnd: false,  //加载后，显示在尾部
                        callback: function (value) {
                            //b_value = value;
                        }
                    };
                    if (window.top == window.self) {
                        $.yqCodePopEdit(show_pops);
                    }
                    else {
                        window.top.$.yqCodePopEdit(show_pops);
                    }
                }
            }],
            columns: [get_columns($object)],
            showGroup: true,
            groupField: "group",
            // groupFormatter:function(group,rows){
            //     console.log(group,rows);  
            // },
            scrollbarSize: 0,
            onAfterEdit: function (index, row, changes) {
                // var props1 = Object.getOwnPropertyNames(changes);
                // if (props1.length > 0) {
                //     opt.endEdit.call($object, index, row);
                // }
            }
        });

        $object.propertygrid("resize", {
            width: opt.editModeW,
            height: opt.editModeH
        });

        setValue($object, opt.ui_type, opt.value);
        form_load($object);
    }

    function get_columns($object) {
        var opt = options($object);

        /*
        var _width1 = parseInt(opt.editModeW * 0.35);
        var _width2 = opt.editModeW - _width1 - 35;
        if (_width1 < 50) {
            _width1 = 50;
        }
        if (_width2 < 50) {
            _width2 = 50;
        }

        var columns = [
            {
                field: 'name', title: '名称', width: _width1+"px"
            }, {
                field: 'value',
                title: '值',
                width:  _width2+"px",
            }
        ];
        */

        var columns = [
            {
                field: 'name', title: '名称', width: "35%"
            }, {
                field: 'value',
                title: '值',
                width: "55%",
            }
        ];

        columns[1].formatter = function (value, row, index) {
            this.p_target = $object;
            return $.yqPgFormatter.call(this, {
                value: value,
                row: row,
                index: index,
                field: "value",
                ui_type: row.ui_type,
                ui_mask: row.ui_mask
            });
        };

        return columns;
    }

    function setValue($object, ui_type, value) {
        var opt = options($object);
        opt.ui_type = ui_type;
        if (typeof value == "string") {
            try {
                value = JSON.parse(value);
            } catch (Error) {
                value = {};
            }
        }

        var titlte = "";
        for (var i = 0; i < opt.uiTypes.length; i++) {
            if (opt.uiTypes[i].no == ui_type) {
                titlte = opt.uiTypes[i].name + "[" + opt.uiTypes[i].no + "]";
                break;
            }
        }
        $object.propertygrid("getPanel").panel("setTitle", titlte);

        value = $.yqUiMaskLoadInit(ui_type, value);
        if (ui_type == 5) {
            if (value.default === null || value.default === "") {
                value.default = $.yqUiMask5_types[0].no;
            } else {
                for (var i = 0; i < $.yqUiMask5_types.length; i++) {
                    if ($.yqUiMask5_types[i].name == value.default) {
                        value.default = $.yqUiMask5_types[i].no;
                        break;
                    }
                }
            }

            var types = "";
            if (typeof value.types == "object") {
                for (var i = 0; i < $.yqUiMask5_types.length; i++) {
                    for (var j = 0; j < value.types.length; j++) {
                        if ($.yqUiMask5_types[i].name == value.types[j]) {
                            types += ((types == "") ? "" : ",") + $.yqUiMask5_types[i].no;
                            break;
                        }
                    }
                }
            } else {
                types = $.yqUiMask5_types[0].no;
            }
            value.types = types;
        }


        opt._value = value;

        var data = blankData($object);

        //自定义数据格式接口
        data = opt.uiMaskLoadInit.call($object, ui_type, value, data);

        for (var i = 0; i < data.rows.length; i++) {
            var val = value[data.rows[i].field];
            if (typeof val != "undefined") {
                data.rows[i].value = val;
            }

            if (!opt.isEdit || data.rows[i].ui_mask.readonly) {
                delete data.rows[i].editor;
            }
            else {
                data.rows[i].editor.options.onChange = function (p_target, newValue) {
                    var index = $object.propertygrid("getRowIndex", $object.propertygrid("getSelected"));
                    if (JSON.stringify(data.rows[index].value) != JSON.stringify(newValue)) {
                        data.rows[index].value = newValue;
                        setTimeout(function () {
                            var newValue = data.rows[index];
                            var title = {
                                name: newValue["field"],
                                ui_title: newValue["name"],
                                ui_type: newValue["ui_type"],
                                ui_mask: newValue["ui_mask"]
                            }

                            if (newValue["ui_type"] == 7) {
                                if (!(newValue.value === undefined || newValue.value === null)) {
                                    newValue.value = newValue.value[newValue["ui_mask"].valueMember];
                                }
                            } else if (newValue["ui_type"] == 14) {
                                if (!(newValue.value === undefined || newValue.value === null)) {
                                    var value = null;
                                    for (var i = 0; i < newValue.value.length; i++) {
                                        if (i == 0) {
                                            value = newValue.value[i][newValue["ui_mask"].valueMember];
                                        } else {
                                            value += "," + newValue.value[i][newValue["ui_mask"].valueMember];
                                        }
                                    }
                                    newValue.value = value;
                                }
                            }

                            newValue.value = $.yqFmToVal(newValue.value, title, false);

                            console.log("onChange", newValue);

                            opt.endEdit.call($object, index, newValue);
                        }, 10);
                    }
                };
            }
        }

        opt.titles = [];
        for (var i = 0; i < data.rows.length; i++) {
            var title = {
                name: data.rows[i]["field"],
                ui_title: data.rows[i]["name"],
                ui_type: data.rows[i]["ui_type"],
                ui_mask: data.rows[i]["ui_mask"],
                ui_visible: true
            }
            opt.titles.push(title);
        }

        setForienKeys($object, value, function () {
            $object.propertygrid("loadData", data);
        });
    }

    //设置行值
    function setfield($object, name, val) {
        var opt = options($object);
        if (val === undefined) {
            val = null;
        }
        if (val === null) {
            delete opt._value[name];
        } else {
            opt._value[name] = val;
        }

        var rows = $object.propertygrid("getRows");
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].field == name) {
                $object.propertygrid("updateRow", {
                    index: i,
                    row: {
                        value: val
                    }
                });
                return;
            }
        }
    }

    function clear($object) {
        $object.propertygrid("loadData", []);
    }

    function getValue($object) {
        var opt = options($object);
        $object.datagrid('acceptChanges');
        var rows = $object.propertygrid("getRows");
        console.log("getValue", rows);
        var value = {};
        var titles = [];
        for (let i = 0; i < rows.length; i++) {
            titles.push({
                name: rows[i]["field"],
                ui_title: rows[i]["name"],
                ui_type: rows[i]["ui_type"],
                ui_mask: rows[i]["ui_mask"],
                ui_visible: true
            });
            value[rows[i]["field"]] = rows[i]["value"];
        }
        if (opt.defaultAdd) {
            value = $.extend(opt._value, value);
        }
        //格式化数据格式
        value = $.yqFmToData(value, titles, [], false)

        value = $.yqUiMaskSaveInit(opt.ui_type, value);
        return value;
    }

    function blankData($object) {
        var opt = options($object);
        var data = {
            "rows": []
        };

        if (opt.ui_type == 1)   //label
        {
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 2, {}));
        }
        else if (opt.ui_type == 2)   //textbox
        {
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小长度",
                value: "",
                group: "校验信息"
            }, 10, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大长度",
                value: "",
                group: "校验信息"
            }, 10, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "format",
                name: "输入掩码",
                value: "",
                group: "掩码",
            }, 2, {}));
        }
        else if (opt.ui_type == 3)   //checkbox
        {
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 3, {}));
        }
        else if (opt.ui_type == 4)   //datebox
        {
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 4, {}));

            data.rows.push($.yqDgEditor({
                field: "min",
                name: "开始日期",
                value: "",
                group: "基础信息"
            }, 4, {}));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "截止日期",
                value: "",
                group: "基础信息"
            }, 4, {}));

            data.rows.push($.yqDgEditor({
                field: "format",
                name: "日期掩码",
                value: "",
                group: "基础信息",
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: "校验信息"
            }, 3, {}));
        }
        else if (opt.ui_type == 5)   //RichTextBox
        {
            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小长度",
                value: "",
                group: "校验信息"
            }, 10, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大长度",
                value: "",
                group: "校验信息"
            }, 10, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "width",
                value: "",
                group: "editMode"
            }, 10, {
                "default": 400,
                "min": 100,
            }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "height",
                value: "",
                group: "editMode"
            }, 10, {
                "default": 300,
                "min": 80,
            }));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认类型",
                value: "",
                group: "editMode"
            }, 6, {
                default: 0,
                lists: $.yqUiMask5_types
            }));

            data.rows.push($.yqDgEditor({
                field: "types",
                name: "选择类型",
                value: "",
                group: "editMode"
            }, 13, {
                default: null,
                lists: $.yqUiMask5_types,
                editModeW: 400,
                editModeH: 120
            }));
        }
        else if (opt.ui_type == 6) { //Combobox
            data.rows.push($.yqDgEditor({
                field: "type",
                name: "值类型",
                value: "int",
                group: "值"
            }, 6, {
                default: "int",
                type: "string",
                lists: [{
                    no: "int",
                    name: "int"
                }, {
                    no: "string",
                    name: "string"
                }]
            }));

            data.rows.push($.yqDgEditor({
                field: "lists",
                name: "取值",
                value: "",
                group: "值"
            }, 15, {
                panelWidth: 400,
                panelHeight: 350,
                valueMember: "no",            //值字段
                displayMember: "name",          //显示字段
                titles: {
                    titles: [
                        {
                            name: "no",
                            ui_title: "No",
                            ui_type: 10,
                            ui_width: 90,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                min: 0,
                                blank: false
                            }
                        }, {
                            name: "name",
                            ui_title: "Name",
                            ui_type: 2,
                            ui_width: 150,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        }
                    ]
                },  //数据列配置对象
                //rows:[],
                rows: [],
                isEdit: true,
                isAdd: true,
                isDel: true,
                toexcel: true,
                excelName: "excel导出",
                editModeW: 400,
                editModeH: 450,
                beforeEditShow: function (run_opt) {
                    var t_rows = $object.propertygrid("getRows");
                    var type_val = "int";
                    for (let i = 0; i < t_rows.length; i++) {
                        if (t_rows[i]["field"] == "type") {
                            type_val = t_rows[i]["value"];
                            break;
                        }
                    }

                    if (type_val == "string") {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 2,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }
                        ];
                    } else {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 10,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    min: 0,
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }
                        ];
                    }

                    return run_opt;
                },
                beforeAdd: function (rows, row, callback) {
                    row["no"] = rows.length + 1;
                    callback(row);
                },
                beforeChange: function (rows, callback) {
                    callback(true, rows);
                }
            }));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "值"
            }, 10, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验"
            }, 3, {}));

        }
        else if (opt.ui_type == 7) { //Forienkey
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "dbName",
                name: "数据库",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "tbName",
                name: "表",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "tempNo",
                name: "模板no",
                value: "",
                group: "基础信息"
            }, 10, {
                min: -1
            }));

            data.rows.push($.yqDgEditor({
                field: "displayType",
                name: "显示类型",
                value: "",
                group: "信息"
            }, 6, {
                default: 2,
                lists: [{ no: 1, name: "下拉列表" }, { no: 2, name: "弹窗" }]
            }));

            data.rows.push($.yqDgEditor({
                field: "valueMember",
                name: "属性字段",
                value: "sid",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "displayMember",
                name: "显示字段",
                value: "sid",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "addWhere",
                name: "附加查询添加",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "order",
                name: "排序",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "mapping",
                name: "字段映射",
                value: "",
                group: "基础信息"
            }, 15, {
                panelWidth: 300,
                panelHeight: 300,
                valueMember: "from",            //值字段
                displayMember: "from",          //显示字段
                param: {
                    titles: [
                        {
                            name: "from",
                            ui_title: "From",
                            ui_type: 2,
                            ui_width: 120,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        }, {
                            name: "to",
                            ui_title: "To",
                            ui_type: 2,
                            ui_width: 120,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        }
                    ]
                },  //数据列配置对象
                //rows:[],
                rows: [],
                isEdit: true,
                editModeW: 300,
                editModeH: 250,
                beforeAdd: function (rows, row, callback) {
                    callback(row);
                },
                beforeChange: function (rows, callback) {
                    callback(true, rows);
                }
            }));

            data.rows.push($.yqDgEditor({
                field: "isPage",
                name: "是否分页",
                value: "",
                group: "分页"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "pageSize",
                name: "每页显示数量",
                value: "10",
                group: "分页"
            }, 10, {}));


            data.rows.push($.yqDgEditor({
                field: "panelWidth",
                name: "显示框宽度",
                value: "10",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "panelHeight",
                name: "显示框高度",
                value: "10",
                group: "显示框"
            }, 10, { min: 30 }));


            data.rows.push($.yqDgEditor({
                field: "expandMember",
                name: "扩展查询字段(用“,”分隔)",
                value: "",
                group: "下拉框"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "isSeek",
                name: "isSeek",
                value: "",
                group: "查询"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "seekNo",
                name: "seekNo",
                value: "10",
                group: "查询"
            }, 10, { min: -1 }));

            data.rows.push($.yqDgEditor({
                field: "seekModeW",
                name: "seekModeW",
                value: "10",
                group: "查询"
            }, 10, { min: 600 }));

            data.rows.push($.yqDgEditor({
                field: "seekModeH",
                name: "seekModeH",
                value: "10",
                group: "查询"
            }, 10, { min: 450 }));

            data.rows.push($.yqDgEditor({
                field: "seekSimple",
                name: "seekSimple",
                value: "",
                group: "查询"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "seekSimpleDDLW",
                name: "seekSimpleDDLW",
                value: "120",
                group: "查询"
            }, 10, { min: 80 }));

            data.rows.push($.yqDgEditor({
                field: "seekSimpleTxtW",
                name: "seekSimpleTxtW",
                value: "150",
                group: "查询"
            }, 10, { min: 80 }));

        }
        else if (opt.ui_type == 8) { //tree
            // "default": [
            //     2,
            //     201,
            //     20101
            // ],
            // "blank": false,
            // "level": 1,
            // "subfield": "treeselect2",
            // "trees": [

            //         ]
            //     }
            // ]

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "[]",
                group: "值"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "level",
                name: "层级",
                value: "1",
                group: "值"
            }, 10, { "min": 1 }));

            data.rows.push($.yqDgEditor({
                field: "subfield",
                name: "下级字段",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "type",
                name: "值类型",
                value: "int",
                group: "值"
            }, 6, {
                default: "int",
                type: "string",
                lists: [{
                    no: "int",
                    name: "int"
                }, {
                    no: "string",
                    name: "string"
                }]
            }));

            data.rows.push($.yqDgEditor({
                field: "trees",
                name: "取值",
                value: "",
                group: "值"
            }, 16, {
                panelWidth: 400,
                panelHeight: 350,
                valueMember: "no",            //值字段
                displayMember: "name",          //显示字段
                titles: {
                    titles: [
                        {
                            name: "no",
                            ui_title: "No",
                            ui_type: 10,
                            ui_width: 90,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                min: 0,
                                blank: false
                            }
                        }, {
                            name: "name",
                            ui_title: "Name",
                            ui_type: 2,
                            ui_width: 150,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        },
                    ]
                },  //数据列配置对象
                //rows:[],
                data: [],
                isEdit: true,
                editModeW: 450,
                editModeH: 450,
                beforeEditShow: function (run_opt) {
                    var t_rows = $object.propertygrid("getRows");
                    var type_val = "int";
                    for (let i = 0; i < t_rows.length; i++) {
                        if (t_rows[i]["field"] == "type") {
                            type_val = t_rows[i]["value"];
                            break;
                        }
                    }

                    //console.log("beforeEditShow",type_val,run_opt);
                    if (type_val == "string") {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 2,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }
                        ];
                    } else {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 10,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    min: 0,
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }
                        ];
                    }

                    return run_opt;
                },
                beforeAdd: function (rows, row, callback) {
                    row["no"] = rows.length + 1;
                    callback(row);
                },
                beforeChange: function (rows, callback) {
                    callback(true, rows);
                }
            }));
        }
        else if (opt.ui_type == 9)   //NumberBox
        {
            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小值",
                value: "",
                group: "校验信息"
            }, 9, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大值",
                value: "",
                group: "校验信息"
            }, 9, { "min": 0 }));

            data.rows.push($.yqDgEditor({
                field: "precision",
                name: "小数位数",
                value: "",
                group: "校验信息",
            }, 10, { min: 0, max: 99 }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: ""
            }, 9, {}));

            data.rows.push($.yqDgEditor({
                field: "groupSeparator",
                name: "数字分隔符",
                value: "",
                group: "",
            }, 2, { min: 0, max: 1 }));
        }
        else if (opt.ui_type == 10)   //NumberSpinner
        {
            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小值",
                value: "",
                group: "校验信息"
            }, 10, {}));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大值",
                value: "",
                group: "校验信息"
            }, 10, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: ""
            }, 10, {}));

            data.rows.push($.yqDgEditor({
                field: "groupSeparator",
                name: "数字分隔符",
                value: "",
                group: "",
            }, 2, { min: 0, max: 1 }));
        }
        else if (opt.ui_type == 11) //TimeSpinner
        {
            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小值",
                value: "",
                group: "校验信息"
            }, 11, { seconds: true }));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大值",
                value: "",
                group: "校验信息"
            }, 11, { seconds: true }));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: ""
            }, 11, { seconds: true }));

            data.rows.push($.yqDgEditor({
                field: "seconds",
                name: "是否包含秒",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: "校验信息"
            }, 3, {}));
        }
        else if (opt.ui_type == 12) //DateTimeBox
        {
            data.rows.push($.yqDgEditor({
                field: "min",
                name: "最小值",
                value: "",
                group: "校验信息"
            }, 12, { seconds: true, format: "yyyy/MM/dd HH:mm:ss" }));

            data.rows.push($.yqDgEditor({
                field: "max",
                name: "最大值",
                value: "",
                group: "校验信息"
            }, 12, { seconds: true, format: "yyyy/MM/dd HH:mm:ss" }));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "校验信息"
            }, 12, { seconds: true, format: "yyyy/MM/dd HH:mm:ss" }));

            data.rows.push($.yqDgEditor({
                field: "format",
                name: "格式化掩码",
                value: "",
                group: "校验信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "seconds",
                name: "是否包含秒",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "是否为空",
                value: "",
                group: ""
            }, 3, {}));
        }
        else if (opt.ui_type == 13) //NCheckBox
        {
            data.rows.push($.yqDgEditor({
                field: "type",
                name: "值类型",
                value: "int",
                group: "值"
            }, 6, {
                default: "int",
                type: "string",
                lists: [{
                    no: "int",
                    name: "int"
                }, {
                    no: "string",
                    name: "string"
                }]
            }));

            data.rows.push($.yqDgEditor({
                field: "lists",
                name: "取值",
                value: "",
                group: "值"
            }, 15, {
                panelWidth: 400,
                panelHeight: 350,
                valueMember: "no",            //值字段
                displayMember: "name",          //显示字段
                titles: [],  //数据列配置对象
                //rows:[],
                rows: [],
                isEdit: true,
                isAdd: true,
                isDel: true,
                toexcel: true,
                excelName: "excel导出",
                editModeW: 485,
                editModeH: 450,
                beforeEditShow: function (run_opt) {
                    var t_rows = $object.propertygrid("getRows");
                    var type_val = "int";
                    for (let i = 0; i < t_rows.length; i++) {
                        if (t_rows[i]["field"] == "type") {
                            type_val = t_rows[i]["value"];
                            break;
                        }
                    }

                    if (type_val == "string") {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 2,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }, {
                                name: "checked",
                                ui_title: "Checked",
                                ui_type: 3,
                                ui_width: 80,
                                ui_visible: true,
                                ui_readonly: false,
                                ui_mask: {}
                            }
                        ];
                    } else {
                        run_opt.titles = [
                            {
                                name: "no",
                                ui_title: "No",
                                ui_type: 10,
                                ui_width: 90,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    min: 0,
                                    blank: false
                                }
                            }, {
                                name: "name",
                                ui_title: "Name",
                                ui_type: 2,
                                ui_width: 250,
                                ui_visible: true,
                                ui_readnnly: false,
                                ui_mask: {
                                    blank: false
                                }
                            }, {
                                name: "checked",
                                ui_title: "Checked",
                                ui_type: 3,
                                ui_width: 80,
                                ui_visible: true,
                                ui_readonly: false,
                                ui_mask: {}
                            }
                        ];
                    }

                    return run_opt;
                },
                beforeAdd: function (rows, row, callback) {
                    row["no"] = rows.length + 1;
                    callback(row);
                },
                beforeChange: function (rows, callback) {
                    callback(true, rows);
                }
            }));

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "width",
                value: "",
                group: "editMode"
            }, 10, {
                "default": 400,
                "min": 100,
            }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "height",
                value: "",
                group: "editMode"
            }, 10, {
                "default": 300,
                "min": 80,
            }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验"
            }, 3, {}));
        }
        else if (opt.ui_type == 14) //NForeignKey
        {
            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "dbName",
                name: "数据库",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "tbName",
                name: "表",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "tempNo",
                name: "模板no",
                value: "",
                group: "基础信息"
            }, 10, {
                min: -1
            }));

            data.rows.push($.yqDgEditor({
                field: "valueMember",
                name: "属性字段",
                value: "sid",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "displayMember",
                name: "显示字段",
                value: "sid",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "isPage",
                name: "是否分页",
                value: "",
                group: "分页"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "pageSize",
                name: "每页显示数量",
                value: "10",
                group: "分页"
            }, 10, {}));


            data.rows.push($.yqDgEditor({
                field: "addWhere",
                name: "附加查询添加",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "order",
                name: "排序",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "mapping",
                name: "字段映射",
                value: "",
                group: "基础信息"
            }, 15, {
                panelWidth: 300,
                panelHeight: 300,
                valueMember: "from",            //值字段
                displayMember: "from",          //显示字段
                param: {
                    titles: [
                        {
                            name: "from",
                            ui_title: "From",
                            ui_type: 2,
                            ui_width: 120,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        }, {
                            name: "to",
                            ui_title: "To",
                            ui_type: 2,
                            ui_width: 120,
                            ui_visible: true,
                            ui_readnnly: false,
                            ui_mask: {
                                blank: false
                            }
                        }
                    ]
                },  //数据列配置对象
                //rows:[],
                rows: [],
                isEdit: true,
                inexcel: false,
                editModeW: 300,
                editModeH: 250,
                beforeAdd: function (rows, row, callback) {
                    callback(row);
                },
                beforeChange: function (rows, callback) {
                    callback(true, rows);
                }
            }));

            data.rows.push($.yqDgEditor({
                field: "panelWidth",
                name: "宽度",
                value: "10",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "panelHeight",
                name: "高度",
                value: "10",
                group: "显示框"
            }, 10, { min: 30 }));


            data.rows.push($.yqDgEditor({
                field: "expandMember",
                name: "扩展查询字段(用“,”分隔)",
                value: "",
                group: "显示框"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "isSeek",
                name: "isSeek",
                value: "",
                group: "查询"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "seekNo",
                name: "seekNo",
                value: "10",
                group: "查询"
            }, 10, { min: -1 }));

            data.rows.push($.yqDgEditor({
                field: "seekModeW",
                name: "seekModeW",
                value: "10",
                group: "查询"
            }, 10, { min: 600 }));

            data.rows.push($.yqDgEditor({
                field: "seekModeH",
                name: "seekModeH",
                value: "10",
                group: "查询"
            }, 10, { min: 450 }));

            data.rows.push($.yqDgEditor({
                field: "seekSimple",
                name: "seekSimple",
                value: "",
                group: "查询"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "seekSimpleDDLW",
                name: "seekSimpleDDLW",
                value: "120",
                group: "查询"
            }, 10, { min: 80 }));

            data.rows.push($.yqDgEditor({
                field: "seekSimpleTxtW",
                name: "seekSimpleTxtW",
                value: "150",
                group: "查询"
            }, 10, { min: 80 }));
        }
        else if (opt.ui_type == 15) { //tbedit 表格数据
            data.rows.push($.yqDgEditor({
                field: "ajaxUrl",
                name: "外部数据源",
                value: "",
                group: ""
            }, 2, {
                default: "",
            }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: true,
                group: ""
            }, 3, {
                default: true,
            }));

            if (opt.treeEdit == false) {
                data.rows.push($.yqDgEditor({
                    field: "param",
                    name: "参数",
                    value: "",
                    group: "基础信息"
                }, 901, {}));
            }

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "显示框宽度",
                value: "500",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "显示框高度",
                value: "400",
                group: "显示框"
            }, 10, { min: 30 }));

            //editType
            data.rows.push($.yqDgEditor({
                field: "editType",
                name: "编辑模式",
                value: 1,
                group: "编辑框"
            }, 6, {
                default: 1,
                lists: [
                    {
                        no: 0,
                        name: "行编辑模式"
                    },
                    {
                        no: 1,
                        name: "属性编辑模式"
                    },
                    {
                        no: 2,
                        name: "form编辑模式"
                    }]
            }));

            data.rows.push($.yqDgEditor({
                field: "modelNo",
                name: "模板",
                value: -1,
                group: "编辑框"
            }, 10, { min: -1, max: 99999 }));

            data.rows.push($.yqDgEditor({
                field: "panelWidth",
                name: "显示框宽度",
                value: "500",
                group: "编辑框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "panelHeight",
                name: "显示框高度",
                value: "400",
                group: "编辑框"
            }, 10, { min: 30 }));
        }
        else if (opt.ui_type == 16) { //tree 属性数据
            data.rows.push($.yqDgEditor({
                field: "ajaxUrl",
                name: "外部数据源",
                value: "",
                group: ""
            }, 2, {
                default: "",
            }));

            //显示字段
            data.rows.push($.yqDgEditor({
                field: "displayMember",
                name: "显示字段",
                value: "name",
                group: ""
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: true,
                group: ""
            }, 3, {
                default: true,
            }));

            if (opt.treeEdit == false) {
                data.rows.push($.yqDgEditor({
                    field: "param",
                    name: "参数",
                    value: "",
                    group: "基础信息"
                }, 901, {}));
            }

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "显示框宽度",
                value: "500",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "显示框高度",
                value: "400",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "modelNo",
                name: "模板",
                value: -1,
                group: "编辑框"
            }, 10, { min: -1, max: 99999 }));

            data.rows.push($.yqDgEditor({
                field: "panelWidth",
                name: "显示框宽度",
                value: "500",
                group: "编辑框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "panelHeight",
                name: "显示框高度",
                value: "400",
                group: "编辑框"
            }, 10, { min: 30 }));
        }
        else if (opt.ui_type == 17) { //attr 属性数据
            data.rows.push($.yqDgEditor({
                field: "ajaxUrl",
                name: "外部数据源",
                value: "",
                group: ""
            }, 2, {
                default: "",
            }));

            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: true,
                group: "校验信息"
            }, 3, {
                default: true,
            }));

            //editType
            data.rows.push($.yqDgEditor({
                field: "editType",
                name: "编辑模式",
                value: 1,
                group: "基础信息"
            }, 6, {
                default: 1,
                lists: [{ no: 1, name: "属性编辑模式" }, { no: 2, name: "form编辑模式" }]
            }));

            data.rows.push($.yqDgEditor({
                field: "modelNo",
                name: "模板",
                value: -1,
                group: "基础信息"
            }, 10, { min: -1, max: 99999 }));

            if (opt.treeEdit == false) {
                data.rows.push($.yqDgEditor({
                    field: "param",
                    name: "参数",
                    value: "",
                    group: "基础信息"
                }, 901, {}));
            }

            data.rows.push($.yqDgEditor({
                field: "loadDefault",
                name: "加载默认值",
                value: false,
                group: "基础信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "显示框宽度",
                value: "500",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "显示框高度",
                value: "400",
                group: "显示框"
            }, 10, { min: 30 }));
        }
        else if (opt.ui_type == 18) { //File 
            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "storageType",
                name: "存储类型",
                value: "",
                group: "基础信息"
            }, 6, {
                default: 2,
                lists: [{ no: 1, name: "数据库存储" },
                { no: 2, name: "外部存储" }
                ]
            }));

            data.rows.push($.yqDgEditor({
                field: "storageName",
                name: "外部存储库名",
                value: "",
                group: "基础信息"
            }, 2, {}));


            data.rows.push($.yqDgEditor({
                field: "chunk",
                name: "分片上传(外部存储生效)",
                value: false,
                group: "基础信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "accept",
                name: "文件掩码",
                default: "image/*",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "directup",
                name: "直接上传（选择文件后立即上传）",
                default: false,
                group: "基础信息"
            }, 3, {}));
        }
        else if (opt.ui_type == 19) { //Html 
            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "type",
                name: "编辑器",
                value: "",
                group: "基础信息"
            }, 6, {
                default: 1,
                lists: [{ no: 1, name: "html" }, { no: 2, name: "markdown" }]
            }));

            data.rows.push($.yqDgEditor({
                field: "storageType",
                name: "存储类型",
                value: "",
                group: "基础信息"
            }, 6, {
                default: 2,
                lists: [{ no: 1, name: "数据库存储" }, { no: 2, name: "外部存储" }]
            }));

            data.rows.push($.yqDgEditor({
                field: "storageName",
                name: "外部存储库名",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "chunk",
                name: "分片上传(外部存储生效)",
                value: false,
                group: "基础信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "accept",
                name: "文件掩码",
                default: "image/*",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "directup",
                name: "直接上传（选择文件后立即上传）",
                default: false,
                group: "基础信息"
            }, 3, {}));
        }
        else if (opt.ui_type == 20) { //20 CSV分隔字符串
            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: true,
                group: "基础信息"
            }, 3, {
                default: true,
            }));

            data.rows.push($.yqDgEditor({
                field: "ui_type",
                name: "字段类型",
                value: "",
                group: "基础信息"
            }, 6, {
                default: 2,
                lists: $.yqUiTypes()
            }));

            data.rows.push($.yqDgEditor({
                field: "separator",
                name: "分隔符",
                value: ",",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "default",
                name: "默认值",
                value: "",
                group: "基础信息"
            }, 2, {}));

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "显示框宽度",
                value: "500",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "显示框高度",
                value: "400",
                group: "显示框"
            }, 10, { min: 30 }));
            
            data.rows.push($.yqDgEditor({
                field: "isMove",
                name: "允许移动",
                value: true,
                group: "显示框"
            }, 3, {
                default: true,
            }));
        }
        else if (opt.ui_type == 21) { //21 Func函数
            data.rows.push($.yqDgEditor({
                field: "blank",
                name: "允许为空",
                value: true,
                group: "基础信息"
            }, 3, {
                default: true,
            }));
        }
        else if (opt.ui_type == 99) { //虚表数据模板 json数据
            data.rows.push($.yqDgEditor({
                default: true,
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "type",
                name: "数据格式",
                value: "",
                group: "基础信息"
            }, 6, {
                default: 1,
                lists: [{ no: 1, name: "单数据" }, { no: 2, name: "多数据" }]
            }));
        } else if (opt.ui_type == 900) { //ui_mask
            data.rows.push($.yqDgEditor({
                field: "ui_type",
                name: "ui_type",
                value: 1,
                group: ""
            }, 6, {
                default: 1,
                lists: $.yqUiTypes()
            }));

            data.rows.push($.yqDgEditor({
                default: false,
                field: "pop_edit",
                name: "弹出编辑",
                value: "",
                group: ""
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                default: true,
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));

            data.rows.push($.yqDgEditor({
                field: "editModeW",
                name: "显示框宽度",
                value: "500",
                group: "显示框"
            }, 10, { min: 30 }));

            data.rows.push($.yqDgEditor({
                field: "editModeH",
                name: "显示框高度",
                value: "400",
                group: "显示框"
            }, 10, { min: 30 }));
        } else if (opt.ui_type == 901) { //titles
            data.rows.push($.yqDgEditor({
                default: true,
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));
        } else {
            data.rows.push($.yqDgEditor({
                default: true,
                field: "blank",
                name: "允许为空",
                value: "",
                group: "校验信息"
            }, 3, {}));
        }

        return data;
    }

    function setForienKeys($object, row, callback) {
        var opt = options($object);
        var rows = [];
        rows.push(row);
        var opts = {
            "rows": rows,
            "titles": opt.titles,
            "fk_rows": opt.fk_rows === undefined ? [] : opt.fk_rows
        };

        $.yqGetForeignkeys(opts,
            function (fk_rows) {
                opt.fk_rows = fk_rows;
                callback();
            });
    }
})(jQuery);

